"""Definition of the Directorio content type
"""

from zope.interface import implements, directlyProvides

from Products.Archetypes import atapi
from Products.ATContentTypes.content import base
from Products.ATContentTypes.content import schemata

from newguegue.newmunicipios import newmunicipiosMessageFactory as _
from newguegue.newmunicipios.interfaces import IDirectorio
from newguegue.newmunicipios.config import PROJECTNAME

DirectorioSchema = schemata.ATContentTypeSchema.copy() + atapi.Schema((

    # -*- Your Archetypes field definitions here ... -*-
   atapi.StringField('title',
                searchable=1,
                isMetadata=0,
                accessor='Title',
                widget=atapi.StringWidget(label='Nombre',
                                      maxlength=150,
                                      size=30,
                                      label_msgid="labeel_entry_title",
                                      description_msgid="help_entry_title",
                                      i18n_domain="newguegue.newmunicipios",
                                      description='')),
    atapi.StringField('description',
                searchable=1,
                isMetadata=0,
                accessor='Description',
                widget=atapi.TextAreaWidget(label='Breve descripción',
                                      label_msgid="label_entry_description",
                                      description_msgid="help_entry_description",
                                      i18n_domain="newguegue.newmunicipios",
                                      description='Entre una breve descripción.')),
    atapi.StringField('direccion',
                searchable=0,
                isMetadata=0,
                widget=atapi.StringWidget(label='Dirección física',
                                      label_msgid="label_entry_direccion",
                                      description_msgid="help_entry_direccion",
                                      i18n_domain="newguegue.newmunicipios",
                                      description='Dirección física')),
    atapi.StringField('telefono',
                searchable=0,
                isMetadata=0,
                widget=atapi.StringWidget(label='Teléfono',
                                      label_msgid="label_entry_telefono",
                                      description_msgid="help_entry_telefono",
                                      i18n_domain="newguegue.newmunicipios",
                                      description='Telefono del contacto')),
    atapi.StringField('fax',
                searchable=1,
                isMetadata=0,
                widget=atapi.StringWidget(label='Fax',
                                      label_msgid="label_entry_fax",
                                      description_msgid="help_entry_fax",
                                      i18n_domain="newguegue.newmunicipios",
                                      description='Fax del contacto')),
    atapi.StringField('email',
                searchable=1,
                isMetadata=0,
                widget=atapi.StringWidget(label='Email',
                                      label_msgid="label_entry_email",
                                      description_msgid="help_entry_email",
                                      i18n_domain="newguegue.newmunicipios",
                                      description='')),
    atapi.StringField('web',
                searchable=0,
                isMetadata=0,
                widget=atapi.StringWidget(label='Sitio web',
                                      label_msgid="label_entry_web",
                                      description_msgid="help_entry_web",
                                      i18n_domain="newguegue.newmunicipios",
                                      description='')),


))

# Set storage on fields copied from ATContentTypeSchema, making sure
# they work well with the python bridge properties.

#DirectorioSchema['title'].storage = atapi.AnnotationStorage()
#DirectorioSchema['description'].storage = atapi.AnnotationStorage()

schemata.finalizeATCTSchema(DirectorioSchema, moveDiscussion=False)

class Directorio(base.ATCTContent):
    """Directorio de los municipios"""
    implements(IDirectorio)

    portal_type = "Directorio"
    schema = DirectorioSchema

 #   title = atapi.ATFieldProperty('title')
 #   description = atapi.ATFieldProperty('description')

atapi.registerType(Directorio, PROJECTNAME)
